#include <iostream>
#include <cstring>

using namespace std;


class MyString
{
	//friend int operator++(int&, int);
	public:
		MyString(const char * str = nullptr);
		MyString(const MyString&);
		MyString& operator=(const MyString&);

		~MyString();
	private:
		char * _str;
};

int operator++(int& num, int)
{
	int temp = num;
	num += 1;
	return temp;
}

MyString::MyString(const char* str)
{
	int length = 0;
	if(str == nullptr)
	{
		length = 1;
		this->_str = new char[1];
	}
	else
	{
		length = strlen(str) + 1;
		this->_str = new char[length];
		strcpy(this->_str, str);
	}
}
MyString::MyString(const MyString& other)
{
	int length = strlen(other._str) + 1;
	this->_str = new char[length];
	strcpy(this->_str, other._str);
}

MyString& MyString::operator=(const MyString& other)
{
	if(this == &other)
	{
		return *this;
	}
	int length = strlen(other._str) + 1;
	delete[] this->_str;
	this->_str = new char[length];
	strcpy(this->_str, other._str);
	return *this;
}

MyString::~MyString(void)
{
	delete[] this->_str;
	this->_str = nullptr;
}
int main(int argc, char **argv)
{
//	MyString mystring();
	int num = 2;
	std::cout<<"num "<<num++<<std::endl;
	std::cout<<"num "<<num<<std::endl;
	return 0;
}
